import store from '@/store'
export const focus = {
  inserted: function(dom, options) {
    dom.focus()
  }
}

export const imgerror = {
  inserted: function(dom, options) {
    dom.onerror = function() {
      console.log('图片加载失败')
      dom.src = options.value
    }
  }
}

export const allow = {
  inserted: function(dom, options) {
    const points = store.state.user.userInfo.roles.points
    if (!points.includes(options.value)) {
      dom.style.display = 'none'
    }
  }
}
